package com.it.service.impl;

import com.it.common.Result;
import com.it.dao.BannerMapper;
import com.it.domain.Banner;
import com.it.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BannerServImpl implements BannerService {

    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public Object AddBanner(Banner banner) {
        if(bannerMapper.AddBanner(banner)>0){
            return Result.success("200","添加成功");
        }
        else {
            return Result.fail("500","添加失败");
        }
    }

    @Override
    public Result SetBannerType(Banner banner) {
        if(bannerMapper.SetBannerType(banner)>0){
            return Result.success("200","更改成功");
        }
        else {
            return Result.fail("500","设置失败");
        }
    }

    @Override
    public List<Banner> SelectBanner(Banner banner) {
        return bannerMapper.SelectBanner(banner);
    }

    @Override
    public List<Banner> getAllBanner() {
        return bannerMapper.getAllBanner();
    }

    @Override
    public List<Banner> getBannerPosition(Integer bannerType) {
        return bannerMapper.getBannerPosition(bannerType);
    }

    @Override
    public Integer DeleteBanner(Integer id) {
        return bannerMapper.DeleteBanner(id);
    }
}
